package com.jty.lib_base.room.dao

import androidx.room.*
import com.jty.lib_base.room.bean.BookNote

@Dao
interface BookNoteDao {
    @Query("SELECT * FROM BOOK_NOTE")
    fun getAll(): List<BookNote>

    @Query("SELECT * FROM BOOK_NOTE WHERE id IN (:ids)")
    fun loadAllByIds(ids: IntArray): List<BookNote>

    @Query("SELECT * FROM BOOK_NOTE WHERE id = (:id) LIMIT 1")
    fun queryById(id: Long): BookNote?


    @Insert
    fun insertAll(vararg bookNotes: BookNote)

    @Insert(onConflict = OnConflictStrategy.REPLACE) //如果有相同的id就替换； ABORT默认这个，如果相同，会报错
    fun insertBookNote(vararg bookNotes: BookNote)

    @Delete
    fun delete(bookNotes: BookNote)

    @Delete
    fun deleteAll(vararg bookNotes: BookNote)

    @Update
    fun updateBookNotes(vararg bookNotes: BookNote)

}